package alertasseguridadservice;

import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.microedition.xml.rpc.Operation;
import javax.microedition.xml.rpc.Type;
import javax.microedition.xml.rpc.ComplexType;
import javax.microedition.xml.rpc.Element;

public class AlertasSeguridadService_Stub implements AlertasSeguridadService, javax.xml.rpc.Stub {

    private String[] _propertyNames;
    private Object[] _propertyValues;

    public AlertasSeguridadService_Stub() {
        _propertyNames = new String[] { ENDPOINT_ADDRESS_PROPERTY };
        _propertyValues = new Object[] { "http://localhost:8080/WebServices/AlertasSeguridadService" };
    }

    public void _setProperty( String name, Object value ) {
        int size = _propertyNames.length;
        for (int i = 0; i < size; ++i) {
            if( _propertyNames[i].equals( name )) {
                _propertyValues[i] = value;
                return;
            }
        }
        String[] newPropNames = new String[size + 1];
        System.arraycopy(_propertyNames, 0, newPropNames, 0, size);
        _propertyNames = newPropNames;
        Object[] newPropValues = new Object[size + 1];
        System.arraycopy(_propertyValues, 0, newPropValues, 0, size);
        _propertyValues = newPropValues;

        _propertyNames[size] = name;
        _propertyValues[size] = value;
    }

    public Object _getProperty(String name) {
        for (int i = 0; i < _propertyNames.length; ++i) {
            if (_propertyNames[i].equals(name)) {
                return _propertyValues[i];
            }
        }
        if (ENDPOINT_ADDRESS_PROPERTY.equals(name) || USERNAME_PROPERTY.equals(name) || PASSWORD_PROPERTY.equals(name)) {
            return null;
        }
        if (SESSION_MAINTAIN_PROPERTY.equals(name)) {
            return new Boolean(false);
        }
        throw new JAXRPCException("Stub does not recognize property: " + name);
    }

    protected void _prepOperation(Operation op) {
        for (int i = 0; i < _propertyNames.length; ++i) {
            op.setProperty(_propertyNames[i], _propertyValues[i].toString());
        }
    }

    public String[] listarPuntosInsegurosTipo(float latitud, float longitud, String tipoInseguridad) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            new Float(latitud),
            new Float(longitud),
            tipoInseguridad
        };

        Operation op = Operation.newInstance( _qname_operation_listarPuntosInsegurosTipo, _type_listarPuntosInsegurosTipo, _type_listarPuntosInsegurosTipoResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String[] listarPuntosInseguros(float latitud, float longitud) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            new Float(latitud),
            new Float(longitud)
        };

        Operation op = Operation.newInstance( _qname_operation_listarPuntosInseguros, _type_listarPuntosInseguros, _type_listarPuntosInsegurosResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String darNivelPunto(float latitud, float longitud) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            new Float(latitud),
            new Float(longitud)
        };

        Operation op = Operation.newInstance( _qname_operation_darNivelPunto, _type_darNivelPunto, _type_darNivelPuntoResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        return (String )((Object[])resultObj)[0];
    }

    public String darNivelInseguridad(double latitud, double longitud) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            new Double(latitud),
            new Double(longitud)
        };

        Operation op = Operation.newInstance( _qname_operation_darNivelInseguridad, _type_darNivelInseguridad, _type_darNivelInseguridadResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        return (String )((Object[])resultObj)[0];
    }

    protected static final QName _qname_operation_listarPuntosInsegurosTipo = new QName( "http://WS.com/", "listarPuntosInsegurosTipo" );
    protected static final QName _qname_operation_darNivelPunto = new QName( "http://WS.com/", "darNivelPunto" );
    protected static final QName _qname_operation_darNivelInseguridad = new QName( "http://WS.com/", "darNivelInseguridad" );
    protected static final QName _qname_operation_listarPuntosInseguros = new QName( "http://WS.com/", "listarPuntosInseguros" );
    protected static final QName _qname_listarPuntosInsegurosTipo = new QName( "http://WS.com/", "listarPuntosInsegurosTipo" );
    protected static final QName _qname_listarPuntosInsegurosTipoResponse = new QName( "http://WS.com/", "listarPuntosInsegurosTipoResponse" );
    protected static final QName _qname_darNivelPunto = new QName( "http://WS.com/", "darNivelPunto" );
    protected static final QName _qname_darNivelPuntoResponse = new QName( "http://WS.com/", "darNivelPuntoResponse" );
    protected static final QName _qname_darNivelInseguridad = new QName( "http://WS.com/", "darNivelInseguridad" );
    protected static final QName _qname_listarPuntosInsegurosResponse = new QName( "http://WS.com/", "listarPuntosInsegurosResponse" );
    protected static final QName _qname_listarPuntosInseguros = new QName( "http://WS.com/", "listarPuntosInseguros" );
    protected static final QName _qname_darNivelInseguridadResponse = new QName( "http://WS.com/", "darNivelInseguridadResponse" );
    protected static final Element _type_listarPuntosInsegurosTipoResponse;
    protected static final Element _type_listarPuntosInsegurosTipo;
    protected static final Element _type_darNivelPunto;
    protected static final Element _type_darNivelInseguridad;
    protected static final Element _type_darNivelInseguridadResponse;
    protected static final Element _type_listarPuntosInsegurosResponse;
    protected static final Element _type_darNivelPuntoResponse;
    protected static final Element _type_listarPuntosInseguros;

    static {
        _type_listarPuntosInsegurosTipo = new Element( _qname_listarPuntosInsegurosTipo, _complexType( new Element[] {
            new Element( new QName( "", "latitud" ), Type.FLOAT ),
            new Element( new QName( "", "longitud" ), Type.FLOAT ),
            new Element( new QName( "", "tipoInseguridad" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listarPuntosInsegurosTipoResponse = new Element( _qname_listarPuntosInsegurosTipoResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, false )}), 1, 1, false );
        _type_darNivelPunto = new Element( _qname_darNivelPunto, _complexType( new Element[] {
            new Element( new QName( "", "latitud" ), Type.FLOAT ),
            new Element( new QName( "", "longitud" ), Type.FLOAT )}), 1, 1, false );
        _type_darNivelPuntoResponse = new Element( _qname_darNivelPuntoResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_darNivelInseguridad = new Element( _qname_darNivelInseguridad, _complexType( new Element[] {
            new Element( new QName( "", "latitud" ), Type.DOUBLE ),
            new Element( new QName( "", "longitud" ), Type.DOUBLE )}), 1, 1, false );
        _type_listarPuntosInseguros = new Element( _qname_listarPuntosInseguros, _complexType( new Element[] {
            new Element( new QName( "", "latitud" ), Type.FLOAT ),
            new Element( new QName( "", "longitud" ), Type.FLOAT )}), 1, 1, false );
        _type_listarPuntosInsegurosResponse = new Element( _qname_listarPuntosInsegurosResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, false )}), 1, 1, false );
        _type_darNivelInseguridadResponse = new Element( _qname_darNivelInseguridadResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, 1, false )}), 1, 1, false );
    }

    private static ComplexType _complexType( Element[] elements ) {
        ComplexType result = new ComplexType();
        result.elements = elements;
        return result;
    }
}
